home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / snz128s / src / bugrep.c < prev    next >
C/C++ Source or Header  |  1994-05-23  |  10KB  |  305 lines

  1. /*
  2.     SNEWS 2.0
  3.  
  4.     Snews - Bug Report Support
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License, version 1, as
  8.     published by the Free Software Foundation.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     See the file COPYING, which contains a copy of the GNU General
  16.     Public License.
  17.  
  18.     Ataru version ported by Graham Judd - gjudd@siward.demon.co.uk
  19.  
  20.  */
  21.  
  22. /*---------------------------- Source Control ------------------------------*/
  23.  
  24. /*
  25.  * $Id: BUGREP.C,v 1.2 1994/02/05 18:46:56 gbj Exp user $
  26.  */
  27.  
  28. /****************************************************************************
  29. *   11 Sep 93   1.01   MSM  Initial Version                                 *
  30. *   26 Sep 93   1.02   MSM  General improvements                            *
  31. *    2 Apr 94    1.03   MSM  Input buffer extended                *
  32. ****************************************************************************/
  33.  
  34. #include "defs.h"
  35. #include "snews.h"
  36. #include "screen.h"
  37. #include "locking.h"
  38.  
  39. #ifdef ATARI
  40. #    include "fileops.h"
  41. #endif
  42.  
  43. void                ask(FILE *tmp, char *question);
  44. char                answer(char *question, char *set);
  45. void                clreos(void);
  46.  
  47. /*------------------------------ Send a bug report ------------------------*/
  48. void              bug_report()
  49. {
  50.     int               ans;
  51.     char              ch;
  52.     FILE             *tmp, *sig;
  53.     int               lct;
  54.     WRK_FILE         *wrk;
  55.     char              buf[80], sig_fn[65];
  56.  
  57.     clrscr();
  58. #ifdef ATARI
  59.     if ((tmp = fopen("reply.tmp", "wt")) == NULL) {
  60.         printf("Snews is unable to open the temporary file needed for mail\n");
  61.         printf("Please check your setup.\n");
  62.         printf("Press any key to return to Snews\n");
  63.         ans = getch();
  64.         return;
  65.     }
  66. #else
  67.     if ((tmp = fopen("reply.tmp", "wt")) == NULL) {
  68.         printf("Snews is unable to open the temporary file needed for mail\n");
  69.         printf("Please check your setup using DIS.EXE\n");
  70.         printf("Press any key to return to Snews\n");
  71.         ans = getch();
  72.         return;
  73.     }
  74. #endif
  75.     gotoxy(20, 1);
  76.     printf("Demon Internet Services - Problem Report.\n\n");
  77.     printf("Do you wish to mail a problem report to the Internet Support Team\n");
  78.     printf("at DEMON ? (y/n) ");
  79.     ans = getch();
  80.     putch(ans);
  81.     putch('\n');
  82.     putch('\n');
  83.     ans = toupper(ans);
  84.     if (ans != 'Y') {
  85.          fclose(tmp);
  86.         unlink("reply.tmp");
  87.         return;
  88.     }
  89.     printf("Please complete the answers to as many of the following questions as you\n");
  90.     printf("can. This will help the team to solve promptly the problem you are having.\n");
  91.     printf("When you have answered a question, press <RETURN> on an empty line to proceed\n");
  92.     printf("to the next question. After answering all the questions, you will be asked to\n");
  93.     printf("confirm that you wish your problem to be sent.\n\n");
  94.  
  95.     sprintf(buf, "Bug report from %s.%s", my_stuff.my_site, my_stuff.my_domain);
  96.  
  97. #ifndef ATARI
  98.     if (make_header(tmp, buf, "internet@demon.net", NULL,
  99.                     NULL, &lct) != 0) {
  100.         printf("Sorry, there is a problem writing to disk, please check your setup\n");
  101.         printf("using DIS.EXE\n");
  102.         printf("Press any key to return to Snews\n");
  103.         ans = getch();
  104.         fclose(tmp);
  105.         unlink("reply.tmp");
  106.         return;
  107.     }
  108. #endif
  109.  
  110.     clreos();
  111.     printf("Please choose one of the following categories:\n\n");
  112.     printf("    1  -  General Problem.\n");
  113.     printf("    2  -  Snews Problem.\n");
  114.     printf("    3  -  KA9Q Problem.\n");
  115.     printf("    4  -  PCElm Problem.\n");
  116.     printf("    5  -  None of the above.\n\n");
  117.     ch = answer("Please enter 1, 2, 3, 4 or 5 -", "12345");
  118.     
  119. #ifdef ATARI
  120.     if (ch == '2')
  121.     {
  122.         if (make_header(tmp, buf, "gjudd@siward.demon.co.uk", NULL,
  123.                     NULL, &lct) != 0) {
  124.             printf("Sorry, there is a problem writing to disk, please check your setup.\n");
  125.             printf("Press any key to return to Snews\n");
  126.             ans = getch();
  127.             fclose(tmp);
  128.             unlink("reply.tmp");
  129.             return;
  130.         }
  131.     }
  132.     else
  133.     {
  134.         if (make_header(tmp, buf, "internet@demon.net", NULL,
  135.                     NULL, &lct) != 0) {
  136.             printf("Sorry, there is a problem writing to disk, please check your setup.\n");
  137.             printf("Press any key to return to Snews\n");
  138.             ans = getch();
  139.             fclose(tmp);
  140.             unlink("reply.tmp");
  141.             return;
  142.         }
  143.     }
  144. #endif    
  145.  
  146.     fprintf(tmp, "Choice %c taken\n\n", ch);
  147.     if (ch == '5')
  148.         ch = '1';
  149.     ask(tmp, "Please describe the problem:");
  150.     if (ch == '1') {
  151.         ask(tmp, "Please give the date and time it occurred:");
  152.         ask(tmp, "What hardware are you using (e.g. PC Compatible, Macintosh) ?");
  153.         ask(tmp, "What Operating System (e.g. MS-DOS 5.0, System 7.0) ?");
  154.         ask(tmp, "What TCP/IP software (e.g. KA9Q 2.11, NET-mac) ?");
  155.         ask(tmp, "Are you using SLIP or PPP ?");
  156.         ask(tmp, "Which modem are you using ?");
  157.         ask(tmp, "Is your modem internal or external ?");
  158.         ask(tmp, "Are you using a buffered UART (16550) ?");
  159.         ask(tmp, "Which Point of Presence were you logged in to ?");
  160.         ask(tmp, "Which tty were you logged in to ?");
  161.         ask(tmp, "Which program and version is giving the problem (e.g. Snews 1.23, pcelm 1.4) ?");
  162.         if (answer("Are you using an IBM compatible (y/n) ?", "YN") == 'Y') {
  163.             ask(tmp, "How much memory is free at the command.com prompt ?");
  164.             ask(tmp, "Are you running directly from DOS or from a multitasker (e.g. Windows\nor DESQview) ?");
  165.         }
  166.         ask(tmp, "Have you read /pub/doc/Modem.txt ?");
  167.         ask(tmp, "Have you read /pub/FAQ/support.faq ?");
  168.         ask(tmp, "Have you read /pub/doc/ka9q/dispc.txt ?");
  169.     }
  170.     if (ch == '2') {
  171.         fprintf(tmp, "2 - Snews Problem, %s (%02d.%02d.%02d)\n\n", VERSION, rmj, rmm, rup);
  172. #ifdef ATARI
  173.         ask(tmp, "What version of TOS are you using ?");
  174.         ask(tmp, "Are you running from the GEM Desktop, a replacement Desktop or a CLI ?");
  175.         ask(tmp, "Are you running a multitasking operating system?");
  176.         ask(tmp, "How much free memory do you have before running SNews?");
  177. #else
  178.         ask(tmp, "What operating system (e.g. MS-DOS 5.0) ?");
  179.            ask(tmp, "Are you running directly from DOS or from a multitasker (e.g. Windows\nor DESQview) ?");
  180.            ask(tmp, "How much memory is free at the command.com prompt ?");
  181. #endif
  182.     }
  183.     if (ch == '3') {
  184.         fprintf(tmp, "3 - KA9Q problem.\n");
  185.         ask(tmp, "Which version of KA9Q (e.g. 2.11) ?");
  186.         ask(tmp, "What Operating System (e.g. MS-DOS 5.0, System 7.0) ?");
  187.            ask(tmp, "Are you running directly from DOS or from a multitasker (e.g. Windows\nor DESQview) ?");
  188.            ask(tmp, "How much memory is free at the command.com prompt ?");
  189.         ask(tmp, "Are you using SLIP or PPP ?");
  190.         ask(tmp, "Which modem are you using ?");
  191.         ask(tmp, "Is your modem internal or external ?");
  192.         ask(tmp, "Are you using a buffered UART (16550) ?");
  193.         ask(tmp, "Which Point of Presence were you logged in to ?");
  194.         ask(tmp, "Which tty were you logged in to ?");
  195.         ask(tmp, "Have you read /pub/doc/Modem.txt ?");
  196.         ask(tmp, "Have you read /pub/FAQ/support.faq ?");
  197.         ask(tmp, "Have you read /pub/doc/ka9q/dispc.txt ?");
  198.     }
  199.     if (ch == '4') {
  200.         fprintf(tmp, "4 - PCElm problem.\n");
  201.         ask(tmp, "Which version of PCElm are you using ?");
  202.         ask(tmp, "What operating system (e.g. MS-DOS 5.0) ?");
  203.            ask(tmp, "Are you running directly from DOS or from a multitasker (e.g. Windows\nor DESQview) ?");
  204.            ask(tmp, "How much memory is free at the command.com prompt ?");
  205.     }
  206.  
  207.     /* append the signature if there is one */
  208.     strcpy(sig_fn, my_stuff.home);
  209.     strcat(sig_fn, my_stuff.signature);
  210.     if ((sig = fopen(sig_fn, "rt")) != NULL) {
  211.         fprintf(tmp, "\n-- \n");
  212.         while(fgets(buf, 79, sig) != NULL)
  213.             fputs(buf, tmp);
  214.     }
  215.     fclose(sig);
  216.  
  217.     fclose(tmp);
  218.  
  219.     clreos();
  220.     printf("\nYour answers have been recorded in a mail file. Please comfirm\n");
  221.     printf("that you wish to send this file to the support team at DEMON.\n\n");
  222.     printf("Send bug report (y/n) ? ");
  223.     do
  224.         {
  225.         ans = getch();
  226.         ans = toupper(ans);
  227.     }
  228.     while ((ans != 'Y') && (ans != 'N'));
  229.     putch(ans);
  230.     if (ans != 'Y')
  231.         unlink("reply.tmp");
  232.     else {
  233.         wrk = parse("reply.tmp", TRUE);
  234.         if (wrk == NULL) {
  235.             unlink("reply.tmp");
  236.             return;
  237.         }
  238.         pass_to_smtp("reply.tmp", wrk, TRUE);
  239.         printf("\n\nYour bug report will be mailed to the Support Team next time you\n");
  240.         printf("successfully connect to DEMON. Press any key to return to Snews. ");
  241.         ans = getch();
  242.     }
  243. }
  244.  
  245. /*------------------------ Clear lower half of screen ---------------------*/
  246. void              clreos()
  247. {
  248.     int            i;
  249.  
  250.     for (i=0;i<14;i++) {
  251.         gotoxy(1, i+12);
  252.         clreol();
  253.     }
  254.     gotoxy(1, 12);
  255. }
  256.  
  257. /*------------------- Ask a question and record the answer ----------------*/
  258. void             ask(FILE *tmp, char *question)
  259. {
  260.     char           buf[512];
  261.     int            i;
  262.  
  263.     printf("%s\n", question);
  264.     fprintf(tmp, "Q. %s\n", question);
  265.     i = 12;
  266.  
  267.     do
  268.         {
  269.         gets(buf);
  270.         putch('\n');
  271.         fputs(buf, tmp);
  272.         fputs("\n", tmp);
  273.         if (++i > 23) {
  274.             i--;
  275.             gotoxy(1, 13);
  276.             delline();
  277.             gotoxy(1, i);
  278.         }
  279.     }
  280.     while (strlen(buf) > 0);
  281.     clreos();
  282. }
  283.  
  284. /*------------------- Ask a question and return the answer ---------------*/
  285. char             answer(char *question, char *set)
  286. {
  287.     int            ch, i;
  288.  
  289.  
  290.     printf("%s", question);
  291.     putch(' ');
  292.     do
  293.     {
  294.         ch = getch();
  295.         ch = toupper(ch);
  296.         for (i=0;i<(int)strlen(set);i++) {
  297.             if (ch == toupper(set[i])) {
  298.                 clreos();
  299.                 return (char)ch;
  300.             }
  301.         }
  302.     }
  303.     while (1==1);
  304. }
  305.